from typing import *
from leetcode.editor.common.node import *


# leetcode submit region begin(Prohibit modification and deletion)
class MyCircularQueue:

    def __init__(self, k: int):
        self.capacity = k
        self.size=0
        self.data = [None] * k
        self.start=0
        self.end=0

    def enQueue(self, value: int) -> bool:
        if self.size == self.capacity:
            return False
        self.data[self.end] = value
        self.end = (self.end + 1+self.capacity)%self.capacity
        self.size +=1
        return True

    def deQueue(self) -> bool:
        if self.size == 0:
            return False
        self.data[self.start]=None
        self.start = (self.start+1+self.capacity)%self.capacity
        self.size-=1
        return True

    def Front(self) -> int:
        if self.size == 0:
            return -1
        return self.data[self.start]

    def Rear(self) -> int:
        if self.size == 0:
            return -1
        return self.data[(self.end-1)%self.capacity]

    def isEmpty(self) -> bool:
        return self.size == 0

    def isFull(self) -> bool:
        return self.size == self.capacity


# Your MyCircularQueue object will be instantiated and called as such:
# obj = MyCircularQueue(k)
# param_1 = obj.enQueue(value)
# param_2 = obj.deQueue()
# param_3 = obj.Front()
# param_4 = obj.Rear()
# param_5 = obj.isEmpty()
# param_6 = obj.isFull()
# leetcode submit region end(Prohibit modification and deletion)


if __name__ == '__main__':
    solution = Solution()
    # your test code here